/*
 * Project Name demo
 * File Name SocketIoConfig
 * Package Name com.huxiaosu.demo.socketio.config
 * Create Time 2023/1/28
 * Create by name：liujie
 */
package com.huxiaosu.demo.socketio.config;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

import java.util.List;
import java.util.Map;

/**
 * Description
 *
 * @ClassName: SocketIoConfig
 * @author: liujie
 * @date: 2023/1/28 13:56
 */
@Data
@Configuration
@ConfigurationProperties(prefix = SocketIoConfig.PREFIX)
public class SocketIoConfig {
    public static final String PREFIX = "socketio";
    /**
     * socket监听端口
     */
    private Integer port = 9999;
    /**
     * socket监听ip
     */
    private String host = "0.0.0.0";
    /**
     * 端口是否重用；默认 true ,如果是 FALSE，可能会出现端口被占用的异常
     */
    private boolean reuseAddress = true;
    /**
     * 连接数大小- 如果只监听一个端口配置 1 就行
     */
    private Integer bossCount = 1;
    /**
     * 当前节点连接总数 默认 10
     */
    private Integer workCount = 10;
    /**
     * 允许请求
     */
    private boolean allowCustomRequests = true;
    /**
     * 协议升级超时时间，默认 60s
     */
    private int upgradeTimeout = 60000;
    /**
     * ping 超时时间，默认 60s
     */
    private int pingTimeout = 60000;
    /**
     * 心跳发送间隔时间 默认 25s
     */
    private int pingInterval = 25000;
    /**
     * tcp低延迟 默认 true
     */
    private boolean tcpNoDelay = true;
    /**
     * 基于 redis 实现多通道推送
     */
    private List<Channel> channel;

    @Data
    public static class Channel{
        /**监听消息实现类*/
        private String className;
        /**一个名字的定义*/
        private String name;
    }
}